home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 32 / Mac Magazin and MacEasy Magazine CD - Issue 32.iso / Grafik & Text / OzTeX3.0 / BibTeX / BibTeX inputs / cite.bst < prev    next >
Text File  |  1996-02-11  |  19KB  |  1,104 lines

  1. % BibTeX standard bibliography style `plain'
  2. % Non-stand bib style made by Max Hailperin  (-max)
  3. % Replaces key as the label rather than consecutive numbers
  4. %
  5. %
  6.     % version 0.99a for BibTeX versions 0.99a or later, LaTeX version 2.09.
  7.     % Copyright (C) 1985, all rights reserved.
  8.     % Copying of this file is authorized only if either
  9.     % (1) you make absolutely no changes to your copy, including name, or
  10.     % (2) if you do make changes, you name it something other than
  11.     % btxbst.doc, plain.bst, unsrt.bst, alpha.bst, and abbrv.bst.
  12.     % This restriction helps ensure that all standard styles are identical.
  13.     % The file btxbst.doc has the documentation for this style.
  14.  
  15. ENTRY
  16.   { address
  17.     author
  18.     booktitle
  19.     chapter
  20.     edition
  21.     editor
  22.     howpublished
  23.     institution
  24.     journal
  25.     key
  26.     month
  27.     note
  28.     number
  29.     organization
  30.     pages
  31.     publisher
  32.     school
  33.     series
  34.     title
  35.     type
  36.     volume
  37.     year
  38.   }
  39.   {}
  40.   { label }
  41.  
  42. INTEGERS { output.state before.all mid.sentence after.sentence after.block }
  43.  
  44. FUNCTION {init.state.consts}
  45. { #0 'before.all :=
  46.   #1 'mid.sentence :=
  47.   #2 'after.sentence :=
  48.   #3 'after.block :=
  49. }
  50.  
  51. STRINGS { s t }
  52.  
  53. FUNCTION {output.nonnull}
  54. { 's :=
  55.   output.state mid.sentence =
  56.     { ", " * write$ }
  57.     { output.state after.block =
  58.     { add.period$ write$
  59.       newline$
  60.       "\newblock " write$
  61.     }
  62.     { output.state before.all =
  63.         'write$
  64.         { add.period$ " " * write$ }
  65.       if$
  66.     }
  67.       if$
  68.       mid.sentence 'output.state :=
  69.     }
  70.   if$
  71.   s
  72. }
  73.  
  74. FUNCTION {output}
  75. { duplicate$ empty$
  76.     'pop$
  77.     'output.nonnull
  78.   if$
  79. }
  80.  
  81. FUNCTION {output.check}
  82. { 't :=
  83.   duplicate$ empty$
  84.     { pop$ "empty " t * " in " * cite$ * warning$ }
  85.     'output.nonnull
  86.   if$
  87. }
  88.  
  89. FUNCTION {output.bibitem}
  90. { newline$
  91.   "\bibitem[" write$
  92.   label write$      %added -max
  93.   "]{" write$       %added -max
  94.   cite$ write$
  95.   "}" write$
  96.   newline$
  97.   ""
  98.   before.all 'output.state :=
  99. }
  100.  
  101. FUNCTION {fin.entry}
  102. { add.period$
  103.   write$
  104.   newline$
  105. }
  106.  
  107. FUNCTION {new.block}
  108. { output.state before.all =
  109.     'skip$
  110.     { after.block 'output.state := }
  111.   if$
  112. }
  113.  
  114. FUNCTION {new.sentence}
  115. { output.state after.block =
  116.     'skip$
  117.     { output.state before.all =
  118.     'skip$
  119.     { after.sentence 'output.state := }
  120.       if$
  121.     }
  122.   if$
  123. }
  124.  
  125. FUNCTION {not}
  126. {   { #0 }
  127.     { #1 }
  128.   if$
  129. }
  130.  
  131. FUNCTION {and}
  132. {   'skip$
  133.     { pop$ #0 }
  134.   if$
  135. }
  136.  
  137. FUNCTION {or}
  138. {   { pop$ #1 }
  139.     'skip$
  140.   if$
  141. }
  142.  
  143. FUNCTION {new.block.checka}
  144. { empty$
  145.     'skip$
  146.     'new.block
  147.   if$
  148. }
  149.  
  150. FUNCTION {new.block.checkb}
  151. { empty$
  152.   swap$ empty$
  153.   and
  154.     'skip$
  155.     'new.block
  156.   if$
  157. }
  158.  
  159. FUNCTION {new.sentence.checka}
  160. { empty$
  161.     'skip$
  162.     'new.sentence
  163.   if$
  164. }
  165.  
  166. FUNCTION {new.sentence.checkb}
  167. { empty$
  168.   swap$ empty$
  169.   and
  170.     'skip$
  171.     'new.sentence
  172.   if$
  173. }
  174.  
  175. FUNCTION {field.or.null}
  176. { duplicate$ empty$
  177.     { pop$ "" }
  178.     'skip$
  179.   if$
  180. }
  181.  
  182. FUNCTION {emphasize}
  183. { duplicate$ empty$
  184.     { pop$ "" }
  185.     { "{\em " swap$ * "}" * }
  186.   if$
  187. }
  188.  
  189. INTEGERS { nameptr namesleft numnames }
  190.  
  191. FUNCTION {format.names}
  192. { 's :=
  193.   #1 'nameptr :=
  194.   s num.names$ 'numnames :=
  195.   numnames 'namesleft :=
  196.     { namesleft #0 > }
  197.     { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't :=
  198.       nameptr #1 >
  199.     { namesleft #1 >
  200.         { ", " * t * }
  201.         { numnames #2 >
  202.         { "," * }
  203.         'skip$
  204.           if$
  205.           t "others" =
  206.         { " et~al." * }
  207.         { " and " * t * }
  208.           if$
  209.         }
  210.       if$
  211.     }
  212.     't
  213.       if$
  214.       nameptr #1 + 'nameptr :=
  215.       namesleft #1 - 'namesleft :=
  216.     }
  217.   while$
  218. }
  219.  
  220. FUNCTION {format.authors}
  221. { author empty$
  222.     { "" }
  223.     { author format.names }
  224.   if$
  225. }
  226.  
  227. FUNCTION {format.editors}
  228. { editor empty$
  229.     { "" }
  230.     { editor format.names
  231.       editor num.names$ #1 >
  232.     { ", editors" * }
  233.     { ", editor" * }
  234.       if$
  235.     }
  236.   if$
  237. }
  238.  
  239. FUNCTION {format.title}
  240. { title empty$
  241.     { "" }
  242.     { title "t" change.case$ }
  243.   if$
  244. }
  245.  
  246. FUNCTION {n.dashify}
  247. { 't :=
  248.   ""
  249.     { t empty$ not }
  250.     { t #1 #1 substring$ "-" =
  251.     { t #1 #2 substring$ "--" = not
  252.         { "--" *
  253.           t #2 global.max$ substring$ 't :=
  254.         }
  255.         {   { t #1 #1 substring$ "-" = }
  256.         { "-" *
  257.           t #2 global.max$ substring$ 't :=
  258.         }
  259.           while$
  260.         }
  261.       if$
  262.     }
  263.     { t #1 #1 substring$ *
  264.       t #2 global.max$ substring$ 't :=
  265.     }
  266.       if$
  267.     }
  268.   while$
  269. }
  270.  
  271. FUNCTION {format.date}
  272. { year empty$
  273.     { month empty$
  274.     { "" }
  275.     { "there's a month but no year in " cite$ * warning$
  276.       month
  277.     }
  278.       if$
  279.     }
  280.     { month empty$
  281.     'year
  282.     { month " " * year * }
  283.       if$
  284.     }
  285.   if$
  286. }
  287.  
  288. FUNCTION {format.btitle}
  289. { title emphasize
  290. }
  291.  
  292. FUNCTION {tie.or.space.connect}
  293. { duplicate$ text.length$ #3 <
  294.     { "~" }
  295.     { " " }
  296.   if$
  297.   swap$ * *
  298. }
  299.  
  300. FUNCTION {either.or.check}
  301. { empty$
  302.     'pop$
  303.     { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  304.   if$
  305. }
  306.  
  307. FUNCTION {format.bvolume}
  308. { volume empty$
  309.     { "" }
  310.     { "volume" volume tie.or.space.connect
  311.       series empty$
  312.     'skip$
  313.     { " of " * series emphasize * }
  314.       if$
  315.       "volume and number" number either.or.check
  316.     }
  317.   if$
  318. }
  319.  
  320. FUNCTION {format.number.series}
  321. { volume empty$
  322.     { number empty$
  323.     { series field.or.null }
  324.     { output.state mid.sentence =
  325.         { "number" }
  326.         { "Number" }
  327.       if$
  328.       number tie.or.space.connect
  329.       series empty$
  330.         { "there's a number but no series in " cite$ * warning$ }
  331.         { " in " * series * }
  332.       if$
  333.     }
  334.       if$
  335.     }
  336.     { "" }
  337.   if$
  338. }
  339.  
  340. FUNCTION {format.edition}
  341. { edition empty$
  342.     { "" }
  343.     { output.state mid.sentence =
  344.     { edition "l" change.case$ " edition" * }
  345.     { edition "t" change.case$ " edition" * }
  346.       if$
  347.     }
  348.   if$
  349. }
  350.  
  351. INTEGERS { multiresult }
  352.  
  353. FUNCTION {multi.page.check}
  354. { 't :=
  355.   #0 'multiresult :=
  356.     { multiresult not
  357.       t empty$ not
  358.       and
  359.     }
  360.     { t #1 #1 substring$
  361.       duplicate$ "-" =
  362.       swap$ duplicate$ "," =
  363.       swap$ "+" =
  364.       or or
  365.     { #1 'multiresult := }
  366.     { t #2 global.max$ substring$ 't := }
  367.       if$
  368.     }
  369.   while$
  370.   multiresult
  371. }
  372.  
  373. FUNCTION {format.pages}
  374. { pages empty$
  375.     { "" }
  376.     { pages multi.page.check
  377.     { "pages" pages n.dashify tie.or.space.connect }
  378.     { "page" pages tie.or.space.connect }
  379.       if$
  380.     }
  381.   if$
  382. }
  383.  
  384. FUNCTION {format.vol.num.pages}
  385. { volume field.or.null
  386.   number empty$
  387.     'skip$
  388.     { "(" number * ")" * *
  389.       volume empty$
  390.     { "there's a number but no volume in " cite$ * warning$ }
  391.     'skip$
  392.       if$
  393.     }
  394.   if$
  395.   pages empty$
  396.     'skip$
  397.     { duplicate$ empty$
  398.     { pop$ format.pages }
  399.     { ":" * pages n.dashify * }
  400.       if$
  401.     }
  402.   if$
  403. }
  404.  
  405. FUNCTION {format.chapter.pages}
  406. { chapter empty$
  407.     'format.pages
  408.     { type empty$
  409.     { "chapter" }
  410.     { type "l" change.case$ }
  411.       if$
  412.       chapter tie.or.space.connect
  413.       pages empty$
  414.     'skip$
  415.     { ", " * format.pages * }
  416.       if$
  417.     }
  418.   if$
  419. }
  420.  
  421. FUNCTION {format.in.ed.booktitle}
  422. { booktitle empty$
  423.     { "" }
  424.     { editor empty$
  425.     { "In " booktitle emphasize * }
  426.     { "In " format.editors * ", " * booktitle emphasize * }
  427.       if$
  428.     }
  429.   if$
  430. }
  431.  
  432. FUNCTION {empty.misc.check}
  433. { author empty$ title empty$ howpublished empty$
  434.   month empty$ year empty$ note empty$
  435.   and and and and and
  436.   key empty$ not and
  437.     { "all relevant fields are empty in " cite$ * warning$ }
  438.     'skip$
  439.   if$
  440. }
  441.  
  442. FUNCTION {format.thesis.type}
  443. { type empty$
  444.     'skip$
  445.     { pop$
  446.       type "t" change.case$
  447.     }
  448.   if$
  449. }
  450.  
  451. FUNCTION {format.tr.number}
  452. { type empty$
  453.     { "Technical Report" }
  454.     'type
  455.   if$
  456.   number empty$
  457.     { "t" change.case$ }
  458.     { number tie.or.space.connect }
  459.   if$
  460. }
  461.  
  462. FUNCTION {format.article.crossref}
  463. { key empty$
  464.     { journal empty$
  465.     { "need key or journal for " cite$ * " to crossref " * crossref *
  466.       warning$
  467.       ""
  468.     }
  469.     { "In {\em " journal * "\/}" * }
  470.       if$
  471.     }
  472.     { "In " key * }
  473.   if$
  474.   " \cite{" * crossref * "}" *
  475. }
  476.  
  477. FUNCTION {format.crossref.editor}
  478. { editor #1 "{vv~}{ll}" format.name$
  479.   editor num.names$ duplicate$
  480.   #2 >
  481.     { pop$ " et~al." * }
  482.     { #2 <
  483.     'skip$
  484.     { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  485.         { " et~al." * }
  486.         { " and " * editor #2 "{vv~}{ll}" format.name$ * }
  487.       if$
  488.     }
  489.       if$
  490.     }
  491.   if$
  492. }
  493.  
  494. FUNCTION {format.book.crossref}
  495. { volume empty$
  496.     { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
  497.       "In "
  498.     }
  499.     { "Volume" volume tie.or.space.connect
  500.       " of " *
  501.     }
  502.   if$
  503.   editor empty$
  504.   editor field.or.null author field.or.null =
  505.   or
  506.     { key empty$
  507.     { series empty$
  508.         { "need editor, key, or series for " cite$ * " to crossref " *
  509.           crossref * warning$
  510.           "" *
  511.         }
  512.         { "{\em " * series * "\/}" * }
  513.       if$
  514.     }
  515.     { key * }
  516.       if$
  517.     }
  518.     { format.crossref.editor * }
  519.   if$
  520.   " \cite{" * crossref * "}" *
  521. }
  522.  
  523. FUNCTION {format.incoll.inproc.crossref}
  524. { editor empty$
  525.   editor field.or.null author field.or.null =
  526.   or
  527.     { key empty$
  528.     { booktitle empty$
  529.         { "need editor, key, or booktitle for " cite$ * " to crossref " *
  530.           crossref * warning$
  531.           ""
  532.         }
  533.         { "In {\em " booktitle * "\/}" * }
  534.       if$
  535.     }
  536.     { "In " key * }
  537.       if$
  538.     }
  539.     { "In " format.crossref.editor * }
  540.   if$
  541.   " \cite{" * crossref * "}" *
  542. }
  543.  
  544. FUNCTION {article}
  545. { output.bibitem
  546.   format.authors "author" output.check
  547.   new.block
  548.   format.title "title" output.check
  549.   new.block
  550.   crossref missing$
  551.     { journal emphasize "journal" output.check
  552.       format.vol.num.pages output
  553.       format.date "year" output.check
  554.     }
  555.     { format.article.crossref output.nonnull
  556.       format.pages output
  557.     }
  558.   if$
  559.   new.block
  560.   note output
  561.   fin.entry
  562. }
  563.  
  564. FUNCTION {book}
  565. { output.bibitem
  566.   author empty$
  567.     { format.editors "author and editor" output.check }
  568.     { format.authors output.nonnull
  569.       crossref missing$
  570.     { "author and editor" editor either.or.check }
  571.     'skip$
  572.       if$
  573.     }
  574.   if$
  575.   new.block
  576.   format.btitle "title" output.check
  577.   crossref missing$
  578.     { format.bvolume output
  579.       new.block
  580.       format.number.series output
  581.       new.sentence
  582.       publisher "publisher" output.check
  583.       address output
  584.     }
  585.     { new.block
  586.       format.book.crossref output.nonnull
  587.     }
  588.   if$
  589.   format.edition output
  590.   format.date "year" output.check
  591.   new.block
  592.   note output
  593.   fin.entry
  594. }
  595.  
  596. FUNCTION {booklet}
  597. { output.bibitem
  598.   format.authors output
  599.   new.block
  600.   format.title "title" output.check
  601.   howpublished address new.block.checkb
  602.   howpublished output
  603.   address output
  604.   format.date output
  605.   new.block
  606.   note output
  607.   fin.entry
  608. }
  609.  
  610. FUNCTION {inbook}
  611. { output.bibitem
  612.   author empty$
  613.     { format.editors "author and editor" output.check }
  614.     { format.authors output.nonnull
  615.       crossref missing$
  616.     { "author and editor" editor either.or.check }
  617.     'skip$
  618.       if$
  619.     }
  620.   if$
  621.   new.block
  622.   format.btitle "title" output.check
  623.   crossref missing$
  624.     { format.bvolume output
  625.       format.chapter.pages "chapter and pages" output.check
  626.       new.block
  627.       format.number.series output
  628.       new.sentence
  629.       publisher "publisher" output.check
  630.       address output
  631.     }
  632.     { format.chapter.pages "chapter and pages" output.check
  633.       new.block
  634.       format.book.crossref output.nonnull
  635.     }
  636.   if$
  637.   format.edition output
  638.   format.date "year" output.check
  639.   new.block
  640.   note output
  641.   fin.entry
  642. }
  643.  
  644. FUNCTION {incollection}
  645. { output.bibitem
  646.   format.authors "author" output.check
  647.   new.block
  648.   format.title "title" output.check
  649.   new.block
  650.   crossref missing$
  651.     { format.in.ed.booktitle "booktitle" output.check
  652.       format.bvolume output
  653.       format.number.series output
  654.       format.chapter.pages output
  655.       new.sentence
  656.       publisher "publisher" output.check
  657.       address output
  658.       format.edition output
  659.       format.date "year" output.check
  660.     }
  661.     { format.incoll.inproc.crossref output.nonnull
  662.       format.chapter.pages output
  663.     }
  664.   if$
  665.   new.block
  666.   note output
  667.   fin.entry
  668. }
  669.  
  670. FUNCTION {inproceedings}
  671. { output.bibitem
  672.   format.authors "author" output.check
  673.   new.block
  674.   format.title "title" output.check
  675.   new.block
  676.   crossref missing$
  677.     { format.in.ed.booktitle "booktitle" output.check
  678.       format.bvolume output
  679.       format.number.series output
  680.       format.pages output
  681.       address empty$
  682.     { organization publisher new.sentence.checkb
  683.       organization output
  684.       publisher output
  685.       format.date "year" output.check
  686.     }
  687.     { address output.nonnull
  688.       format.date "year" output.check
  689.       new.sentence
  690.       organization output
  691.       publisher output
  692.     }
  693.       if$
  694.     }
  695.     { format.incoll.inproc.crossref output.nonnull
  696.       format.pages output
  697.     }
  698.   if$
  699.   new.block
  700.   note output
  701.   fin.entry
  702. }
  703.  
  704. FUNCTION {conference} { inproceedings }
  705.  
  706. FUNCTION {manual}
  707. { output.bibitem
  708.   author empty$
  709.     { organization empty$
  710.     'skip$
  711.     { organization output.nonnull
  712.       address output
  713.     }
  714.       if$
  715.     }
  716.     { format.authors output.nonnull }
  717.   if$
  718.   new.block
  719.   format.btitle "title" output.check
  720.   author empty$
  721.     { organization empty$
  722.     { address new.block.checka
  723.       address output
  724.     }
  725.     'skip$
  726.       if$
  727.     }
  728.     { organization address new.block.checkb
  729.       organization output
  730.       address output
  731.     }
  732.   if$
  733.   format.edition output
  734.   format.date output
  735.   new.block
  736.   note output
  737.   fin.entry
  738. }
  739.  
  740. FUNCTION {mastersthesis}
  741. { output.bibitem
  742.   format.authors "author" output.check
  743.   new.block
  744.   format.title "title" output.check
  745.   new.block
  746.   "Master's thesis" format.thesis.type output.nonnull
  747.   school "school" output.check
  748.   address output
  749.   format.date "year" output.check
  750.   new.block
  751.   note output
  752.   fin.entry
  753. }
  754.  
  755. FUNCTION {misc}
  756. { output.bibitem
  757.   format.authors output
  758.   title howpublished new.block.checkb
  759.   format.title output
  760.   howpublished new.block.checka
  761.   howpublished output
  762.   format.date output
  763.   new.block
  764.   note output
  765.   fin.entry
  766.   empty.misc.check
  767. }
  768.  
  769. FUNCTION {phdthesis}
  770. { output.bibitem
  771.   format.authors "author" output.check
  772.   new.block
  773.   format.btitle "title" output.check
  774.   new.block
  775.   "PhD thesis" format.thesis.type output.nonnull
  776.   school "school" output.check
  777.   address output
  778.   format.date "year" output.check
  779.   new.block
  780.   note output
  781.   fin.entry
  782. }
  783.  
  784. FUNCTION {proceedings}
  785. { output.bibitem
  786.   editor empty$
  787.     { organization output }
  788.     { format.editors output.nonnull }
  789.   if$
  790.   new.block
  791.   format.btitle "title" output.check
  792.   format.bvolume output
  793.   format.number.series output
  794.   address empty$
  795.     { editor empty$
  796.     { publisher new.sentence.checka }
  797.     { organization publisher new.sentence.checkb
  798.       organization output
  799.     }
  800.       if$
  801.       publisher output
  802.       format.date "year" output.check
  803.     }
  804.     { address output.nonnull
  805.       format.date "year" output.check
  806.       new.sentence
  807.       editor empty$
  808.     'skip$
  809.     { organization output }
  810.       if$
  811.       publisher output
  812.     }
  813.   if$
  814.   new.block
  815.   note output
  816.   fin.entry
  817. }
  818.  
  819. FUNCTION {techreport}
  820. { output.bibitem
  821.   format.authors "author" output.check
  822.   new.block
  823.   format.title "title" output.check
  824.   new.block
  825.   format.tr.number output.nonnull
  826.   institution "institution" output.check
  827.   address output
  828.   format.date "year" output.check
  829.   new.block
  830.   note output
  831.   fin.entry
  832. }
  833.  
  834. FUNCTION {unpublished}
  835. { output.bibitem
  836.   format.authors "author" output.check
  837.   new.block
  838.   format.title "title" output.check
  839.   new.block
  840.   note "note" output.check
  841.   format.date output
  842.   fin.entry
  843. }
  844.  
  845. FUNCTION {default.type} { misc }
  846.  
  847. MACRO {jan} {"January"}
  848.  
  849. MACRO {feb} {"February"}
  850.  
  851. MACRO {mar} {"March"}
  852.  
  853. MACRO {apr} {"April"}
  854.  
  855. MACRO {may} {"May"}
  856.  
  857. MACRO {jun} {"June"}
  858.  
  859. MACRO {jul} {"July"}
  860.  
  861. MACRO {aug} {"August"}
  862.  
  863. MACRO {sep} {"September"}
  864.  
  865. MACRO {oct} {"October"}
  866.  
  867. MACRO {nov} {"November"}
  868.  
  869. MACRO {dec} {"December"}
  870.  
  871. MACRO {acmcs} {"ACM Computing Surveys"}
  872.  
  873. MACRO {acta} {"Acta Informatica"}
  874.  
  875. MACRO {cacm} {"Communications of the ACM"}
  876.  
  877. MACRO {ibmjrd} {"IBM Journal of Research and Development"}
  878.  
  879. MACRO {ibmsj} {"IBM Systems Journal"}
  880.  
  881. MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
  882.  
  883. MACRO {ieeetc} {"IEEE Transactions on Computers"}
  884.  
  885. MACRO {ieeetcad}
  886.  {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
  887.  
  888. MACRO {ipl} {"Information Processing Letters"}
  889.  
  890. MACRO {jacm} {"Journal of the ACM"}
  891.  
  892. MACRO {jcss} {"Journal of Computer and System Sciences"}
  893.  
  894. MACRO {scp} {"Science of Computer Programming"}
  895.  
  896. MACRO {sicomp} {"SIAM Journal on Computing"}
  897.  
  898. MACRO {tocs} {"ACM Transactions on Computer Systems"}
  899.  
  900. MACRO {tods} {"ACM Transactions on Database Systems"}
  901.  
  902. MACRO {tog} {"ACM Transactions on Graphics"}
  903.  
  904. MACRO {toms} {"ACM Transactions on Mathematical Software"}
  905.  
  906. MACRO {toois} {"ACM Transactions on Office Information Systems"}
  907.  
  908. MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
  909.  
  910. MACRO {tcs} {"Theoretical Computer Science"}
  911.  
  912. READ
  913.  
  914. FUNCTION {sortify}
  915. { purify$
  916.   "l" change.case$
  917. }
  918.  
  919. INTEGERS { len }
  920.  
  921. FUNCTION {chop.word}
  922. { 's :=
  923.   'len :=
  924.   s #1 len substring$ =
  925.     { s len #1 + global.max$ substring$ }
  926.     's
  927.   if$
  928. }
  929.  
  930. FUNCTION {sort.format.names}
  931. { 's :=
  932.   #1 'nameptr :=
  933.   ""
  934.   s num.names$ 'numnames :=
  935.   numnames 'namesleft :=
  936.     { namesleft #0 > }
  937.     { nameptr #1 >
  938.     { "   " * }
  939.     'skip$
  940.       if$
  941.       s nameptr "{vv{ } }{ll{ }}{  ff{ }}{  jj{ }}" format.name$ 't :=
  942.       nameptr numnames = t "others" = and
  943.     { "et al" * }
  944.     { t sortify * }
  945.       if$
  946.       nameptr #1 + 'nameptr :=
  947.       namesleft #1 - 'namesleft :=
  948.     }
  949.   while$
  950. }
  951.  
  952. FUNCTION {sort.format.title}
  953. { 't :=
  954.   "A " #2
  955.     "An " #3
  956.       "The " #4 t chop.word
  957.     chop.word
  958.   chop.word
  959.   sortify
  960.   #1 global.max$ substring$
  961. }
  962.  
  963. FUNCTION {author.sort}
  964. { author empty$
  965.     { key empty$
  966.     { "to sort, need author or key in " cite$ * warning$
  967.       ""
  968.     }
  969.     { key sortify }
  970.       if$
  971.     }
  972.     { author sort.format.names }
  973.   if$
  974. }
  975.  
  976. FUNCTION {author.editor.sort}
  977. { author empty$
  978.     { editor empty$
  979.     { key empty$
  980.         { "to sort, need author, editor, or key in " cite$ * warning$
  981.           ""
  982.         }
  983.         { key sortify }
  984.       if$
  985.     }
  986.     { editor sort.format.names }
  987.       if$
  988.     }
  989.     { author sort.format.names }
  990.   if$
  991. }
  992.  
  993. FUNCTION {author.organization.sort}
  994. { author empty$
  995.     { organization empty$
  996.     { key empty$
  997.         { "to sort, need author, organization, or key in " cite$ * warning$
  998.           ""
  999.         }
  1000.         { key sortify }
  1001.       if$
  1002.     }
  1003.     { "The " #4 organization chop.word sortify }
  1004.       if$
  1005.     }
  1006.     { author sort.format.names }
  1007.   if$
  1008. }
  1009.  
  1010. FUNCTION {editor.organization.sort}
  1011. { editor empty$
  1012.     { organization empty$
  1013.     { key empty$
  1014.         { "to sort, need editor, organization, or key in " cite$ * warning$
  1015.           ""
  1016.         }
  1017.         { key sortify }
  1018.       if$
  1019.     }
  1020.     { "The " #4 organization chop.word sortify }
  1021.       if$
  1022.     }
  1023.     { editor sort.format.names }
  1024.   if$
  1025. }
  1026.  
  1027. FUNCTION {presort}
  1028. { type$ "book" =
  1029.   type$ "inbook" =
  1030.   or
  1031.     'author.editor.sort
  1032.     { type$ "proceedings" =
  1033.     'editor.organization.sort
  1034.     { type$ "manual" =
  1035.         'author.organization.sort
  1036.         'author.sort
  1037.       if$
  1038.     }
  1039.       if$
  1040.     }
  1041.   if$
  1042.   "    "
  1043.   *
  1044.   year field.or.null sortify
  1045.   *
  1046.   "    "
  1047.   *
  1048.   title field.or.null
  1049.   sort.format.title
  1050.   *
  1051.   #1 entry.max$ substring$
  1052.   'sort.key$ :=
  1053. }
  1054.  
  1055. ITERATE {presort}
  1056.  
  1057. SORT
  1058.  
  1059. STRINGS { longest.label }
  1060.  
  1061. INTEGERS { number.label longest.label.width }
  1062.  
  1063. FUNCTION {initialize.longest.label}
  1064. { "" 'longest.label :=
  1065.   #1 'number.label :=
  1066.   #0 'longest.label.width :=
  1067. }
  1068.  
  1069. FUNCTION {longest.label.pass}
  1070. { cite$ 'label :=    % added -max (was number.label int.to.str$ 'label := )
  1071.   number.label #1 + 'number.label :=
  1072.   label width$ longest.label.width >
  1073.     { label 'longest.label :=
  1074.       label width$ 'longest.label.width :=
  1075.     }
  1076.     'skip$
  1077.   if$
  1078. }
  1079.  
  1080. EXECUTE {initialize.longest.label}
  1081.  
  1082. ITERATE {longest.label.pass}
  1083.  
  1084. FUNCTION {begin.bib}
  1085. { preamble$ empty$
  1086.     'skip$
  1087.     { preamble$ write$ newline$ }
  1088.   if$
  1089.   "\begin{thebibliography}{"  longest.label  * "}" * write$ newline$
  1090. }
  1091.  
  1092. EXECUTE {begin.bib}
  1093.  
  1094. EXECUTE {init.state.consts}
  1095.  
  1096. ITERATE {call.type$}
  1097.  
  1098. FUNCTION {end.bib}
  1099. { newline$
  1100.   "\end{thebibliography}" write$ newline$
  1101. }
  1102.  
  1103. EXECUTE {end.bib}
  1104.